package com.cloudkinto.common;

import com.cloudkinto.entity.*;
import com.cloudkinto.extentity.*;
import com.cloudkinto.service.ecang.vo.ECangPageProductRes;
import com.cloudkinto.service.ecang.vo.ECangPageRes;
import com.cloudkinto.service.fbaorderoutput.vo.FbaOrderOutputComputationalCostsReq;
import com.cloudkinto.service.finance.vo.exportVo.*;
import com.cloudkinto.service.orderback.vo.FbaOrderBackPageRes;
import com.cloudkinto.service.orderback.vo.FbaOrderBackProductDetailRes;
import com.cloudkinto.service.orderoutput.vo.*;
import com.cloudkinto.service.serialmanage.vo.SerialNumberExportVo;
import com.cloudkinto.service.shipprice.vo.FbaComputerPriceReq;
import com.cloudkinto.service.stock.vo.ShippingAddressAddReq;
import com.cloudkinto.service.stock.vo.ShippingAddressDetailRes;
import com.cloudkinto.service.stock.vo.ShippingAddressUpdateReq;
import com.cloudkinto.service.stock.vo.StockSnapshotExportVo;
import com.cloudkinto.service.stock.vo.log.StockLogExportVo;
import com.cloudkinto.service.stock.vo.log.StockLogPageRes;
import com.cloudkinto.service.storage.vo.FbaStorageAddReq;
import com.cloudkinto.service.storage.vo.FbaStoragePageRes;
import com.cloudkinto.service.storage.vo.FbaStorageUpdateReq;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.Calendar;

/**
 * @author zhujiale
 * @description 对象拷贝公共
 * @date 2022/9/19
 */
@Mapper
public interface BeanConvert {
    BeanConvert INSTANCE = Mappers.getMapper(BeanConvert.class);

    /**
     *示例
     *@param UserDo source
     *@result UserDto target
     */
    //@Mapping(source = "userName", target = "userNameCN")
    //UserDto userDto(UserDo userDo);

    /****************************Ding******************************/


    /****************************Hua******************************/


    /****************************Zhu******************************/
    //运费试算-FBA试算
    FbaOrderOutputComputationalCostsReq fbaOrderOutputComputationalCostsReq(FbaComputerPriceReq req);

    //新增FBA仓库
    FbaStorageDo fbaStorageDo(FbaStorageAddReq req);

    //编辑FBA仓库
    FbaStorageDo fbaStorageDo(FbaStorageUpdateReq req);

    //FBA仓库分页返回
    FbaStoragePageRes fbaStoragePageRes(FbaStorageDo fbaStorageDo);

    //收货地址新增
    ShippingAddressDo shippingAddressDo(ShippingAddressAddReq req);

    //收货地址修改
    ShippingAddressDo shippingAddressUpdateDo(ShippingAddressUpdateReq req);

    //收货地址详情
    ShippingAddressDetailRes shippingAddressDetailRes(ShippingAddressDo addressDo);

    //库存快照导出excel
    StockSnapshotExportVo stockSnapshotExportVo(StockSnapshotPageDto dto);

    //序列号管理导出excel
    SerialNumberExportVo serialNumberExportVo(SerialNumberPageDto dto);

    StockLogExportVo stockLogExportVo(StockLogPageRes et);

    @Mappings({@Mapping(source = "eCangPageRes.referenceNo", target = "orderNo"),
            @Mapping(source = "eCangPageRes.orderCode", target = "platformNumber"),
//            @Mapping(source = "eCangPageRes.smCode", target = "trackId"),
            @Mapping(source = "eCangPageRes.receiptAddress.firstname", target = "receiverName"),
            @Mapping(source = "eCangPageRes.receiptAddress.postcode", target = "postCode"),
            @Mapping(source = "eCangPageRes.receiptAddress.streetAddress1", target = "address"),
            @Mapping(source = "eCangPageRes.receiptAddress.state", target = "area"),
            @Mapping(source = "eCangPageRes.receiptAddress.phone", target = "telPhone")})
    OrderOutputAddReq eCangOrder2Out(ECangPageRes eCangPageRes);

    @Mappings({
            @Mapping(source = "eCangPageRes.receiptAddress.firstname", target = "firstname"),
            @Mapping(source = "eCangPageRes.receiptAddress.company", target = "company"),
            @Mapping(source = "eCangPageRes.receiptAddress.city", target = "city"),
            @Mapping(source = "eCangPageRes.receiptAddress.country", target = "country"),
            @Mapping(source = "eCangPageRes.receiptAddress.state", target = "state"),
            @Mapping(source = "eCangPageRes.receiptAddress.streetAddress1", target = "streetAddress1"),
            @Mapping(source = "eCangPageRes.receiptAddress.streetAddress2", target = "streetAddress2"),
            @Mapping(source = "eCangPageRes.receiptAddress.district", target = "district"),
            @Mapping(source = "eCangPageRes.receiptAddress.postcode", target = "postcode"),
            @Mapping(source = "eCangPageRes.receiptAddress.doorplate", target = "doorplate"),
            @Mapping(source = "eCangPageRes.receiptAddress.email", target = "email"),
            @Mapping(source = "eCangPageRes.receiptAddress.phone", target = "phone")})
    OrderEcangDo eCangPage2Order(ECangPageRes eCangPageRes);

    @Mappings({@Mapping(source = "orderEcangDo.referenceNo", target = "orderNo"),
            @Mapping(source = "orderEcangDo.orderCode", target = "platformNumber"),
//            @Mapping(source = "eCangPageRes.smCode", target = "trackId"),
            @Mapping(source = "orderEcangDo.firstname", target = "receiverName"),
            @Mapping(source = "orderEcangDo.postcode", target = "postCode"),
            @Mapping(source = "orderEcangDo.streetAddress1", target = "address"),
            @Mapping(source = "orderEcangDo.state", target = "area"),
            @Mapping(source = "orderEcangDo.phone", target = "telPhone")})
    OrderOutputUpdateReq eCangOrder2OutUpdate(OrderEcangDo orderEcangDo);

    OrderOutputPackageUpdateReq orderPackage2Update(OrderOutputPackageDo orderOutputPackageDo);

    @Mappings({
            @Mapping(source = "orderOutputPackageDo.warehouseSku", target = "commoditySku"),
            @Mapping(source = "orderOutputPackageDo.quantity", target = "count")})
    OrderOutputProductDetail ecangProduct2OrderUpdate(OrderEcangProductDo orderOutputPackageDo);

    @Mappings({@Mapping(source = "eCangPageProductRes.warehouseProductBarcode", target = "warehouseSku"),
            @Mapping(source = "eCangPageProductRes.quantity", target = "quantity")})
    OrderEcangProductDo ecangProduct2Do(ECangPageProductRes eCangPageProductRes);

    OrderOutputUpdateReq orderOutPut2Update(OrderOutputDo orderOutputDo);

    CostRecordPageRes costRecord2PageRes(CostRecordDo costRecordDo);


    @Mappings({
            @Mapping(source = "orderCostExportDto.receiverName", target = "receiveName")})
    OrderOutputNewVo orderCostDto2ExportVo(OrderCostExportDto orderCostExportDto);

    @Mappings({
            @Mapping(source = "orderCostExportDto.packageCount", target = "packageCount"),
            @Mapping(source = "orderCostExportDto.packageLength", target = "length"),
            @Mapping(source = "orderCostExportDto.packageWidth", target = "width"),
            @Mapping(source = "orderCostExportDto.packageHeight", target = "height"),
            @Mapping(source = "orderCostExportDto.packageWeight", target = "weight")})
    OrderOutPackageVo orderCostDto2PackageExportVo(OrderCostExportDto orderCostExportDto);

    @Mappings({
            @Mapping(source = "orderCostExportDto.skuLength", target = "length"),
            @Mapping(source = "orderCostExportDto.skuWidth", target = "width"),
            @Mapping(source = "orderCostExportDto.skuHeight", target = "height"),
            @Mapping(source = "orderCostExportDto.skuWeight", target = "weight")})
    OrderOutProductVo orderCostDto2ProductExportVo(OrderCostExportDto orderCostExportDto);

    StockFeeVo costStock2Export(StockHistoryDo stockHistoryDo);

    OrderBackVo orderBack2Export(OrderBackDto orderBackDto);

    OrderOutputYamatoSizeExcelExportVo yamatoSizeDto2ExportVo(OrderOutputYamatoSizeExcelExportDto orderOutputYamatoSizeExcelExportDto);

    FbaOrderBackProductDetailRes fbaBackProductVo(FbaOrderBackProductDo fbaOrderBackProductDo);

    FbaOrderBackPageRes fbaBackOrderVo(FbaOrderBackDo fbaOrderBackProductDo);

    OrderBackProductVo orderBackProduct2Export(OrderBackProductDto orderBackDto);
}
